<template>
  <div>
    <div class="header">
      <img
        src="../../assets/images/fanhui.png"
        height="23"
        alt=""
        @click="btn"
      />
      <div>消息详情</div>
    </div>

    <div class="box">
      <div class="box-top">
        <div class="box-top-l">{{ data.title }}</div>
        <div style="color: #999">{{ data.createTime }}</div>
      </div>
      <p style="color: #999; font-size: 14px">发布人：{{ data.sourceName }}</p>

      <div class="context">
        {{ data.msgDate }}
      </div>
    </div>
  </div>
</template>

<script>
import { messageId, updates } from "../../request/api";
export default {
  data() {
    return {
      data: [],
    };
  },
  created() {
    var ids = this.$route.params.id;
    messageId(ids).then((res) => {
      if (res.errCode == 0) {
        let { data } = res;
        this.data = data;
      }
    });
    let datas = {
      id: this.$route.params.id,
    };
    let formData = new FormData();
    for (let key in datas) {
      formData.append(key, datas[key]);
    }
    updates(formData).then((res) => {
      console.log(res);
      if(res.errCode==0){
          this.bool = false;
      }
    })     
  },

  methods: {
    btn() {
      this.$router.back();
    },
  },
};
</script>
 
<style lang = "less" scoped>
* {
  padding: 0;
  margin: 0;
}

.box {
  padding: 15px;
  background: #fff;
}
.box-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.context {
  margin-top: 20px;
  color: #999;
}
.header {
  width: 100vw;
  height: 64px;
  background: #003399;
  display: flex;
  color: #fff;
  font-size: 22px;
  padding: 25px 10px;
  box-sizing: border-box;
  img {
    margin-top: 3px;
    margin-right: 120px;
  }
}
</style>